package com.thunisoft.incremental.dao;

import com.thunisoft.incremental.common.model.Datasource;
import com.thunisoft.incremental.common.model.DatasourceExample;
import java.util.List;
import org.apache.ibatis.annotations.Delete;
import org.apache.ibatis.annotations.DeleteProvider;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.InsertProvider;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Result;
import org.apache.ibatis.annotations.Results;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.SelectProvider;
import org.apache.ibatis.annotations.Update;
import org.apache.ibatis.annotations.UpdateProvider;
import org.apache.ibatis.type.JdbcType;

public interface DatasourceMapper {
    /**
     * This method was generated by MyBatis Generator.
     * This method corresponds to the database table copy_from.t_datasource
     *
     * @mbggenerated Wed Apr 01 17:51:43 CST 2020
     */
    @SelectProvider(type=DatasourceSqlProvider.class, method="countByExample")
    int countByExample(DatasourceExample example);

    /**
     * This method was generated by MyBatis Generator.
     * This method corresponds to the database table copy_from.t_datasource
     *
     * @mbggenerated Wed Apr 01 17:51:43 CST 2020
     */
    @DeleteProvider(type=DatasourceSqlProvider.class, method="deleteByExample")
    int deleteByExample(DatasourceExample example);

    /**
     * This method was generated by MyBatis Generator.
     * This method corresponds to the database table copy_from.t_datasource
     *
     * @mbggenerated Wed Apr 01 17:51:43 CST 2020
     */
    @Delete({
        "delete from copy_from.t_datasource",
        "where c_id = #{id,jdbcType=VARCHAR}"
    })
    int deleteByPrimaryKey(String id);

    /**
     * This method was generated by MyBatis Generator.
     * This method corresponds to the database table copy_from.t_datasource
     *
     * @mbggenerated Wed Apr 01 17:51:43 CST 2020
     */
    @Insert({
        "insert into copy_from.t_datasource (c_id, c_name, ",
        "c_ip, n_port, c_database, ",
        "c_username, c_password, ",
        "dt_createtime, dt_updatetime)",
        "values (#{id,jdbcType=VARCHAR}, #{name,jdbcType=VARCHAR}, ",
        "#{ip,jdbcType=VARCHAR}, #{port,jdbcType=INTEGER}, #{database,jdbcType=VARCHAR}, ",
        "#{username,jdbcType=VARCHAR}, #{password,jdbcType=VARCHAR}, ",
        "#{createtime,jdbcType=TIMESTAMP}, #{updatetime,jdbcType=TIMESTAMP})"
    })
    int insert(Datasource record);

    /**
     * This method was generated by MyBatis Generator.
     * This method corresponds to the database table copy_from.t_datasource
     *
     * @mbggenerated Wed Apr 01 17:51:43 CST 2020
     */
    @InsertProvider(type=DatasourceSqlProvider.class, method="insertSelective")
    int insertSelective(Datasource record);

    /**
     * This method was generated by MyBatis Generator.
     * This method corresponds to the database table copy_from.t_datasource
     *
     * @mbggenerated Wed Apr 01 17:51:43 CST 2020
     */
    @SelectProvider(type=DatasourceSqlProvider.class, method="selectByExample")
    @Results({
        @Result(column="c_id", property="id", jdbcType=JdbcType.VARCHAR, id=true),
        @Result(column="c_name", property="name", jdbcType=JdbcType.VARCHAR),
        @Result(column="c_ip", property="ip", jdbcType=JdbcType.VARCHAR),
        @Result(column="n_port", property="port", jdbcType=JdbcType.INTEGER),
        @Result(column="c_database", property="database", jdbcType=JdbcType.VARCHAR),
        @Result(column="c_username", property="username", jdbcType=JdbcType.VARCHAR),
        @Result(column="c_password", property="password", jdbcType=JdbcType.VARCHAR),
        @Result(column="dt_createtime", property="createtime", jdbcType=JdbcType.TIMESTAMP),
        @Result(column="dt_updatetime", property="updatetime", jdbcType=JdbcType.TIMESTAMP)
    })
    List<Datasource> selectByExample(DatasourceExample example);

    /**
     * This method was generated by MyBatis Generator.
     * This method corresponds to the database table copy_from.t_datasource
     *
     * @mbggenerated Wed Apr 01 17:51:43 CST 2020
     */
    @Select({
        "select",
        "c_id, c_name, c_ip, n_port, c_database, c_username, c_password, dt_createtime, ",
        "dt_updatetime",
        "from copy_from.t_datasource",
        "where c_id = #{id,jdbcType=VARCHAR}"
    })
    @Results({
        @Result(column="c_id", property="id", jdbcType=JdbcType.VARCHAR, id=true),
        @Result(column="c_name", property="name", jdbcType=JdbcType.VARCHAR),
        @Result(column="c_ip", property="ip", jdbcType=JdbcType.VARCHAR),
        @Result(column="n_port", property="port", jdbcType=JdbcType.INTEGER),
        @Result(column="c_database", property="database", jdbcType=JdbcType.VARCHAR),
        @Result(column="c_username", property="username", jdbcType=JdbcType.VARCHAR),
        @Result(column="c_password", property="password", jdbcType=JdbcType.VARCHAR),
        @Result(column="dt_createtime", property="createtime", jdbcType=JdbcType.TIMESTAMP),
        @Result(column="dt_updatetime", property="updatetime", jdbcType=JdbcType.TIMESTAMP)
    })
    Datasource selectByPrimaryKey(String id);

    /**
     * This method was generated by MyBatis Generator.
     * This method corresponds to the database table copy_from.t_datasource
     *
     * @mbggenerated Wed Apr 01 17:51:43 CST 2020
     */
    @UpdateProvider(type=DatasourceSqlProvider.class, method="updateByExampleSelective")
    int updateByExampleSelective(@Param("record") Datasource record, @Param("example") DatasourceExample example);

    /**
     * This method was generated by MyBatis Generator.
     * This method corresponds to the database table copy_from.t_datasource
     *
     * @mbggenerated Wed Apr 01 17:51:43 CST 2020
     */
    @UpdateProvider(type=DatasourceSqlProvider.class, method="updateByExample")
    int updateByExample(@Param("record") Datasource record, @Param("example") DatasourceExample example);

    /**
     * This method was generated by MyBatis Generator.
     * This method corresponds to the database table copy_from.t_datasource
     *
     * @mbggenerated Wed Apr 01 17:51:43 CST 2020
     */
    @UpdateProvider(type=DatasourceSqlProvider.class, method="updateByPrimaryKeySelective")
    int updateByPrimaryKeySelective(Datasource record);

    /**
     * This method was generated by MyBatis Generator.
     * This method corresponds to the database table copy_from.t_datasource
     *
     * @mbggenerated Wed Apr 01 17:51:43 CST 2020
     */
    @Update({
        "update copy_from.t_datasource",
        "set c_name = #{name,jdbcType=VARCHAR},",
          "c_ip = #{ip,jdbcType=VARCHAR},",
          "n_port = #{port,jdbcType=INTEGER},",
          "c_database = #{database,jdbcType=VARCHAR},",
          "c_username = #{username,jdbcType=VARCHAR},",
          "c_password = #{password,jdbcType=VARCHAR},",
          "dt_createtime = #{createtime,jdbcType=TIMESTAMP},",
          "dt_updatetime = #{updatetime,jdbcType=TIMESTAMP}",
        "where c_id = #{id,jdbcType=VARCHAR}"
    })
    int updateByPrimaryKey(Datasource record);
}